-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate FAQ page into the Typesense backend #401
base: main
Are you sure you want to change the base?
Conversation
✔️ Deploy Preview for wargabantuwarga ready! 🔨 Explore the source changes: c719fb6 🔍 Inspect the deploy log: https://app.netlify.com/sites/wargabantuwarga/deploys/61112a64ec09e70008223f64 😎 Browse the preview: https://deploy-preview-401--wargabantuwarga.netlify.app |
# Conflicts: # pages/faq.tsx
…wargabantuwarga.com into feature/typesense-faq
@ekamuktia After some discussions with @zainfathoni earlier, we decided to go forward with using Typesense, since the current search infrastructure gave us more problems than expected (e.g. #405). Therefore we need to migrate to Typesense sooner than expected. Let's see if we can get this up and running asap as a proof-of-concept, so we can apply it to other places (e.g. province search). |
@resir014 @zainfathoni Local: bandicam.2021-07-25.19-46-51-524.mp4Deploy Preview: bandicam.2021-07-25.20-09-17-685.mp4 |
lib/typesense.ts
Outdated
}) { | ||
const searchAdapter = new TypesenseInstantSearchAdapter({ | ||
server: { | ||
apiKey: "FByczfHEjsTCihgkkYlq2YbAgUKMoyVP", // Be sure to use the search-only-api-key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should start storing these secrets on an environment variable. @zainfathoni what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Just let me or @resir014 know what environment variable to store, Mbak @ekamuktia, we can do it for you. 😁
# Conflicts: # __tests__/pages/faq.test.tsx
@zainfathoni @ekamuktia Created an environment variable in the Netlify dashboard called |
What about the GitHub Actions build, @resir014? I think we should also put some env vars on the GitHub Secrets, shouldn't we? |
… into feature/typesense-faq � Conflicts: � _content/home-page.md
Codecov Report
@@ Coverage Diff @@
## main #401 +/- ##
===========================================
- Coverage 79.69% 52.22% -27.48%
===========================================
Files 110 90 -20
Lines 1266 1057 -209
Branches 418 321 -97
===========================================
- Hits 1009 552 -457
- Misses 251 498 +247
- Partials 6 7 +1
Continue to review full report at Codecov.
|
For this, how can I use it on the code? Like this process.env.NEXT_PUBLIC_TYPESENSE_API_KEY? @famasya @zainfathoni @resir014
|
For the sorting, it's intended since the schema I wrote doesn't store any numeric value to be sorted. Results are sorted by relevance by default. Do you need any sortable field for this @ekamuktia ? If so, I'll put that on |
Yes, something like that. I've updated the GitHub Secrets accordingly. |
… into feature/typesense-faq � Conflicts: � pages/faq.tsx
Tried to use |
@famasya |
… into feature/typesense-faq � Conflicts: � __tests__/pages/faq.test.tsx � package.json � pages/faq.tsx � yarn.lock
…wargabantuwarga.com into feature/typesense-faq
Putting a reference: https://www.algolia.com/doc/guides/building-search-ui/going-further/server-side-rendering/react/ In case we want to support static filtering via path param |
How can I checkout from this branch ya 😂? |
You can use GitHub VSCode Extension, Mas @mazipan. |
// import { faqBuilder } from "~/lib/__mocks__/builders/faq"; | ||
// import faqs from "~/lib/data/faqs"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented code should not be pushed.
import faqs from "~/lib/data/faqs"; | ||
import FaqPage from "../../pages/faq"; | ||
|
||
// import { perBuild } from "@jackfranklin/test-data-bot"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented code should not be pushed.
const filtersParam: { [key: string]: string[] } = {}; | ||
const filterFields = filterSettings?.map((cur) => cur.field) ?? []; | ||
Object.entries(queryParams).forEach(([key, value]) => { | ||
if (key == "q") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use strict equality operator ===
if (keywordsParam) { | ||
searchParams.query = keywordsParam; | ||
} | ||
} else if (key == "sort") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use strict equality operator ===
Closes #377
Description
Using
react-instantsearch-dom
, creating custom components forSearchBox
,Hits
, andRefinementList
Current Tasks
SearchBox
,Hits
, andRefinementList